package com.sun.component;

import android.os.Bundle;
import android.view.View;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.sun.lib.base.BaseMvpActivity;
import com.sun.lib.base.basemvp.Presenter;
import com.sun.lib.callback.LoginCallBack;
import com.sun.lib.constant.ConstantArouter;
import com.sun.lib.factory.ServiceFactory;

@Route(path = ConstantArouter.PATH_MAIN_ACTIVITY)
public class MainActivity extends BaseMvpActivity {

    @Override
    protected void initialize(Bundle savedInstanceState) {

    }

    @Override
    protected int getLayoutResID() {
        return R.layout.activity_main;
    }

    public void openLogin(View view) {
        if(!ServiceFactory.getInstance().getLoginService().isLogin()) {
            /*ARouter.getInstance().build(ConstantArouter.PATH_LOGIN_ACTIVITY)
                    .navigation(this);*/
            ServiceFactory.getInstance().getLoginService().login(this, () -> {
                showToast("用户登录成功!");
            });
        }else{
            showToast("用户已经登录!");
        }
        //IntentUtil.startActivity(this, ConstantArouter.PATH_LOGIN_ACTIVITY);
    }

    @Override
    protected Presenter createPresenter() {
        return null;
    }
}
